package dimension.starry.effect;

import dimension.starry.StarryDimension;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;

import java.util.Arrays;

public enum Effects {
    THIRSTY("thirsty", 14996639, StatusEffectCategory.HARMFUL);

    private final String name;
    private final int color;
    private final RPGEffect statusEffect;
    private final StatusEffectCategory category;

    Effects(String name, int color, StatusEffectCategory category) {
        this.name = name;
        this.color = color;
        this.category = category;
        this.statusEffect = new RPGEffect(category, color);
    }

    public static void onInitialize() {
        Arrays.stream(Effects.values())
            .forEach(effect -> Registry.register(Registries.STATUS_EFFECT,
                new Identifier(StarryDimension.MOD_ID, effect.getName()), effect.statusEffect
            ));
    }

    public String getName() {
        return name;
    }

    public StatusEffect getStatusEffect() {
        return statusEffect;
    }

}
